
#ifndef _MEMBER_BCLASS_H_
#define _MEMBER_BCLASS_H_

#include <BMap>
#include <BClass>

#define class_member(cls)	((member_BClass*)((BClass*)cls)->_ptr)

namespace BWE
{
	class Method : public BThing
	{
	public:
		inline Method()
		{
			line = -1;
			virt = false;
			cnst = false;
			cfunc = 0;
		}

		inline bool empty() const
		{
			return cfunc == 0 && value.empty();
		}

		int					line;
		bool				virt;
		bool				cnst;
		BString				type;
		CFunc				cfunc;
		BValue				value;
		BArray<BVariant>	params;
	};
	typedef BHolder<Method>			MethodHolder;
	typedef BArray<MethodHolder>	MethodHolderArray;

	bool AnalyseDeclare(const BString& declare, BString& type, BString& name);
	bool AnalyseDeclare(const BString& declare, BString& type, BString& name, BStringList& params);

	class member_BClass
	{
	public:
		member_BClass(BClass* cls);
		~member_BClass();

		bool checkInherit(const BString& type);

		BClass*				boss;
		bool				meta;
		BString				type;
		BExpHolderArray		inherits;
		BMap<BString, MethodHolder>	methodMap;
		BMap<BString, BVariant>		variantMap;
	};

}

#endif